package com.dzl.movie;

import com.dzl.base.controller.BaseController;
import com.dzl.config.exception.CommonException;
import com.dzl.moive.pojo.WelfareMovieCinema;
import com.dzl.moive.pojo.query.WelfareMovieCinemaWithCodeQuery;
import com.dzl.moive.service.WelfareMovieCinemaService;
import com.dzl.util.EmptyUtils;
import com.dzl.util.PageUtils;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 电影院信息(welfare_movie_cinema)表控制层
 * @author ChenLong
 * @date 2021-11-03 10:46
 */
@RestController
@RequestMapping("/welfareMovieCinema")
public class WelfareMovieCinemaController extends BaseController {

    @Autowired
    private WelfareMovieCinemaService service;

    /**
     * 电影院列表分页查询
     * @date 2021/11/03 10:46
     * @author ChenLong
     * @param query 查询条件
     */
    @GetMapping("/getMovieCinemaListPage")
    public PageUtils<WelfareMovieCinema> getMovieCinemaListPage(WelfareMovieCinemaWithCodeQuery query) {
        if(EmptyUtils.isEmpty(query.getMovieId())){
            throw new CommonException("电影不能为空");
        }
        PageInfo<WelfareMovieCinema> pageInfo = service.getMovieCinemaListPage(query);
        return new PageUtils<>(pageInfo);
    }
}
